<?php
/*
 * @Author: your name
 * @Date: 2021-11-05 17:57:08
 * @LastEditTime: 2021-11-22 14:30:04
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \property\app\Models\admin_model\TeachingCulture.php
 */
namespace App\Models\admin_model;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class TeachingCulture extends Model
{
    use HasFactory;
    static string $tableName = 'teaching_culture';

    public static function teachingList($whereStr = '', $limitStr = '')
    {
  
    return DB::select(' SELECT * FROM '.self::$tableName.' as `teaching`  WHERE `teaching`.`delete_time` is null '.$whereStr.' ORDER BY `top_time` DESC,`id` DESC  '.$limitStr  );  
    }

    public static function teachingCount($whereStr = '')
    {
        return DB::select(' SELECT COUNT(*) as `count` FROM '.self::$tableName.' as `teaching`  WHERE `teaching`.`delete_time` is null '.$whereStr  );  

    }

    public static function teachingClass(){
        // echo ' SELECT `id`,`sheetName` FROM '.self::$tableName.' WHERE `delete_time` is null GROUP BY `sheetName` '  ;
        return Db::select(' SELECT `sheetName` as `title`,`sheetName` as `value` FROM '.self::$tableName.' WHERE `delete_time` is null GROUP BY `sheetName` ORDER BY `id` ASC '  );
    }

    

    


}
